﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data;

namespace MySoftWare.DataAccess.DBProvider
{
    public class SqlServerProvider : IDbProvider
    {
        public DbProviderFactory GetInstance()
        {
            return SqlClientFactory.Instance;
        }
         
        public void DeriveParameters(IDbCommand cmd)
        {
            if ((cmd as SqlCommand) != null)
            {
                SqlCommandBuilder.DeriveParameters(cmd as SqlCommand);
            }
        }

        public DbParameter MakeParam(string ParamName, DbType DbType, Int32 Size)
        {
            SqlParameter param = new SqlParameter();
            param.ParameterName = ParamName;
            param.DbType = DbType;
            if (Size > 0)
                param.Size = Size;
            return param;
        }

        public bool IsFullTextSearchEnabled()
        {
            return true;
        }

        public bool IsCompactDatabase()
        {
            return true;
        }

        public bool IsBackupDatabase()
        {
            return true;
        }
    }
}
